Skip to main content

Focus

AutomatR.Windows.Activities.Focus

The "Focus" activity in AutomatR for Windows UI Automation sets the keyboard focus to a specified UI element. This activity is useful for ensuring that the desired UI element is active and ready for user interactions.

Properties

NameDescription
Input
Windows SelectorAllows you to define the UI element using a Windows Selector. Use the browse button to indicate the element on the app. String variables containing the Windows Selector.
Windows ElementAllows you to provide the UI element directly using the Selector variable. InArgument<Selector> variables containing information about the UI element.
Misc
Display NameProvides a customizable name for the activity displayed in the workflow. String variables containing the desired display name.
Optional
TimeoutSpecifies the time (in seconds) for the activity to execute before throwing an exception. Integer variables containing the timeout duration.
DelaySpecifies the amount of time (in seconds) to wait before starting the activity. Integer variables containing the delay duration. Ex.: If the amount of time is 1000 milliseconds or 1 sec, i.e., 1.

How to use:

  1. Drag and drop the "Focus" activity onto the workflow.
  2. Configure the properties by either providing the Windows Selector or the Windows Element directly.
  3. Optionally, configure the timeout and delay settings.
  4. Execute the workflow to set focus to the specified UI element.

Example: Consider an example where the "Focus" activity is used to set focus to a text box within a specific window:

Focus:
Display Name: "Set Focus to TextBox"
Windows Selector: "WindowSelector"
Timeout: 5

In this example, the activity sets focus to the text box within the specified window. The timeout is set to 5 seconds, and the activity waits for the specified delay before execution.